package com.sc.nft.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sc.nft.entity.MallMemberEquityTarget;
import com.sc.nft.entity.MallMemberEquityUseRecord;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 商城会员权益对应福利 Mapper 接口
 * </p>
 *
 * @author author
 * @since 2024-04-02
 */
public interface MallMemberEquityUseRecordMapper extends BaseMapper<MallMemberEquityUseRecord> {

    MallMemberEquityUseRecord getByOrderId(@Param("orderId") Long orderId);

    int checkUseCount(@Param("mallEquityId") Long mallEquityId, @Param("userId") Long userId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);

    /**
     * 获取用户通过会员权益下单列表
     *
     * @param memberId
     * @param mallMemberEquityTemplateId
     * @param userId
     * @return
     */
    List<MallMemberEquityUseRecord> getByMallMemberEquityId(@Param("memberId") Long memberId, @Param("mallMemberEquityTemplateId") Long mallMemberEquityTemplateId, @Param("userId") Long userId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
}
